package com.libraryManage.commons.utils;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.libraryManage.commons.config.Const;
import io.swagger.annotations.ApiModelProperty;


/**
 * 接口返回类，包括状态和信息，没有返回数据
 */
public class SimpleResp {

    @ApiModelProperty(notes="返回码", required = true)
    private int code;

    @ApiModelProperty(notes="描述", required = true)
    private String msg;


    public SimpleResp() {
    	this.code= Const.STAT_SUCC;
    	this.msg=Const.MSG_SUCC;
    }

    public SimpleResp(int code, String msg) {
    	setMsg(msg);
    	setCode(code);
    }

	@JsonIgnore
    public boolean isSuccess() {
        return code == Const.STAT_SUCC;
    }

    @JsonIgnore
    public boolean notFount() {
        return code == Const.STAT_SYSERR;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public int getCode() {
        return code;
    }

    public void setMsg(String msg) {
       this.msg = msg;
    }

    public String getMsg() {
        return msg;
    }

}
